<div class="col-md-12 observable-export">

    <div class="row" ng-controller="CaseObservablesExportCtrl" ng-if="selection.artifacts.length > 0">
        <div class="col-md-12">
            <form class="form-inline mh-l">
				<div class="form-group hpad10">
					<span class="btn btn-sm btn-default" ng-click="toggleTEList();selection.Action = 'main'">
			            <i class="fa fa-chevron-left"></i>
			            Back
			        </span>
				</div>

                <div class="form-group hpad10">
                    <label>File format</label>
                    <div class="btn-group">
                        <label uib-btn-radio="'csv'" class="btn btn-default btn-sm" name="format" ng-model="exportParams.format">CSV</label>
                        <label uib-btn-radio="'txt'" class="btn btn-default btn-sm" name="format" ng-model="exportParams.format">TEXT</label>
                        <label uib-btn-radio="'misp'" class="btn btn-default btn-sm" name="format" ng-model="exportParams.format">MISP</label>
                    </div>
                </div>
                <div class="form-group hpad10">
                    <label>Protect</label>
                    <div class="btn-group">
                        <label uib-btn-radio="'fang'" class="btn btn-default btn-sm" name="protect" ng-model="exportParams.protect">Yes</label>
                        <label uib-btn-radio="'defang'" class="btn btn-default btn-sm" name="protect" ng-model="exportParams.protect">No</label>
                    </div>
                </div>
                <div class="form-group hpad10 pull-right">
                    <button type="button" class="btn btn-success btn-sm" ng-click="copyToClipboard()">
                        <i class="fa fa-copy"></i>
                        Copy to clipboard</button>
                    <button type="button" class="btn btn-success btn-sm" ng-csv="getCSV" filename="{{'observables.' + exportParams.format}}">
                        <i class="fa fa-download"></i>
                        Save to file</button>

                </div>
            </form>

			<div class="mh-l mh-l mt-l mb-s">
				<h4>Preview of the data to export</h4>
			</div>

            <div class="well well-sm mh-l" ng-switch="exportParams.format">
                <table ng-switch-when="txt">
                    <tr style="overflow: hidden" ng-repeat="el in selection.artifacts">
                        <td class="wrap">
							{{getObservableValue(el)}}
                        </td>
                    </tr>
                </table>

                <table ng-switch-when="csv">
                    <tr style="overflow: hidden" ng-repeat="el in selection.artifacts">
                        <td class="wrap">
                            {{getDataType(el)}};{{getObservableValue(el)}}
                        </td>
                    </tr>
                </table>

                <table ng-switch-when="misp">
                    <tr style="overflow: hidden" ng-repeat="el in selection.artifacts">
                        <td width="200">
							*{{getDataType(el)}}
                        </td>
                        <td>
							:{{getObservableValue(el)}}
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

</div>
